package config {
	import com.xjw.FcousManage;
	import com.xjw.adapte.AdapteManager;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.external.ExternalInterface;

	public class TConfig {
		//图片的大小
		public var IMAGE_WIDTH:int = 870;
		public var IMAGE_HEIGHT:int = 556;
		//电子白板的大小Electron
		public var ELECTRON_WIDTH:int = 800;
		public var ELECTRON_HEIGHT:int = 600;
		//电子白板最大的大小
		public var MAX_ELECTRON:int = 10;
		public var MIN_ELECTRON:int = -10;
		public static var USER_ROLE:String = '授权';
		public static var CLEAR_ROLE:String = '收回';
		private static var _instance:TConfig;
		public static var MEETING:Boolean = false;
		public static var TEACHING:Boolean = true;
		//视频的宽度
		public var VIDEO_WIDTH:int = 239;
		//视频的高度
		public var VIDEO_HEIGHT:int = 180;
		/**
		 *Enter键的值
		 */
		public var ENTER_CODE:uint = 13;
		//两个字节的长度
		public static var SHORT_LENGTH:int = 65535;
		public static var SEGMENT_LENGTH:int = (SHORT_LENGTH - 3) / 4;
		//声音传输
		public static var VOICE:String = "_Voice_";
		public static var SCROLL_OFF:String = "off";
		//是否被T出去,如果被T出去的用户,或者自己的帐号在别的地方进行登陆,将不会重新连接FMS和Socket
		public var isT:Boolean = false;
		public var stage:Sprite;
		//授权
		public var isRole:Boolean = false;
		/**
		 * 是否是Demo版本的
		 */
		public var isDemo:Boolean = false;
		/**
		 * 调整视频的最后宽度
		 */
		public var lastVideoWidth:int;
		/**
		 * 调整视频的最后高度
		 */
		public var lastVideoHeight:int;
		/**
		 * 调整视频的最后侦速
		 */
		public var lastVideoRate:int;
		/**
		 * 调整视频的最后质量
		 */
		public var lastvideoQuantity:int;
		public var screenWidth:Number;
		public var screenHeight:Number;
		/**
		 * 左边的区域宽度
		 */
		public var leftWidth:int = 250;
		/**
		 * 上边的区域的高度
		 */
		public var topHeight:int = 45;
		public var isPeer:Boolean = false;
		/**
		 * 视频列表的视频的宽度
		 */
		public var ONE_VIDEO_WIDTH:Number = 110;
		/**
		 *视频列表的视频的高度
		 */
		public var ONE_VIDEO_HEIGHT:Number = 101;
		/**
		 *原始视频的宽度
		 */
		public var OLD_VIDEO_WIDTH:Number = 110;
		/**
		 *原始视频的高度
		 */
		public var OLD_VIDEO_HEIGHT:Number = 101;
		/**
		 * chat的聊天框原始大小
		 */
		public var CHAT_OLD_HEIGHT:Number = 189;
		public static var NO_PEERID:String = "AA";
		public var mainStage:Stage;
		public var mainSprite:Sprite;
		/**
		 * 是否弹出服务器连接断开
		 */
		public var isAlertServerDisconnect:Boolean = true;

		//根据实际的大小来调整
		public function TConfig(se:SingleStance){
			if (se == null){
				throw new Error('请使用单例');
			}
		}

		public static function getInstance():TConfig {
			if (_instance == null){
				_instance = new TConfig(new SingleStance());
			}
			return _instance;
		}
		public var startTime:Date = new Date(2010, 10, 8);
		public var endTime:Date = new Date(2010, 11, 8);
		private var ipAddress:String = 'http://218.86.76.8';

		//IP地址验证
		public function ipValidate():Boolean {
			var url:String = ExternalInterface.call('window.location.href.toString');
			var ret:Boolean = true;
			if (url.search(ipAddress) != 0){
				ret = false;
			}
			return ret;
		}

		public function initStage(stage:Stage):void {
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.showDefaultContextMenu = false;
			screenWidth = stage.stageWidth;
			screenHeight = stage.stageHeight;
			AdapteManager.getInstance().setStage(stage);
			this.mainStage = stage;
			FcousManage.getInstance().stage = stage;
		}

		public function get stageHeight():Number {
			return this.mainStage.stageHeight;
		}

		public function get stageWidht():Number {
			return this.mainStage.stageWidth;
		}
	}
}

class SingleStance {
}